/*遗弃中,等待重启*/

//#include "stm32f4xx.h"                  // Device header
//#include "stm32f4xx_conf.h"
//#include "LED.h"
//#include "Delay.h"

//void I2C_I2CInit(void)
//{
//	RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C2,ENABLE);
//	RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOF,ENABLE);
//	
//	GPIO_InitTypeDef GPIO_InitStructure;
//	GPIO_InitStructure.GPIO_Mode=GPIO_Mode_AF;
//	GPIO_InitStructure.GPIO_OType=GPIO_OType_PP;
//	GPIO_InitStructure.GPIO_PuPd=GPIO_PuPd_UP;
//	GPIO_InitStructure.GPIO_Pin=GPIO_Pin_0 | GPIO_Pin_1;
//	GPIO_InitStructure.GPIO_Speed=GPIO_Speed_100MHz;
//	GPIO_Init(GPIOF,&GPIO_InitStructure);
//	
//	GPIO_PinAFConfig(GPIOF,GPIO_PinSource0,GPIO_AF_I2C2);
//	GPIO_PinAFConfig(GPIOF,GPIO_PinSource1,GPIO_AF_I2C2);
//	
//	I2C_InitTypeDef I2C_InitStructure;
//	I2C_InitStructure.I2C_Mode=I2C_Mode_I2C;
//	I2C_InitStructure.I2C_ClockSpeed=10000;
//	I2C_InitStructure.I2C_DutyCycle=I2C_DutyCycle_16_9;
//	I2C_InitStructure.I2C_Ack=I2C_Ack_Enable;
//	I2C_InitStructure.I2C_AcknowledgedAddress=I2C_AcknowledgedAddress_7bit;
//	I2C_InitStructure.I2C_OwnAddress1=0x01;
//	I2C_Init(I2C2,&I2C_InitStructure);
//	
//	I2C2->CR1 |= I2C_CR1_SWRST;
//	I2C2->CR1 &= ~I2C_CR1_SWRST;
//	
//	I2C_Cmd(I2C2,ENABLE);
//}

//void I2C_WaitEvent(I2C_TypeDef *I2Cx,uint32_t I2C_EVENT)
//{
//	uint32_t Timeout=10000;
//	while(I2C_CheckEvent(I2Cx,I2C_EVENT)!=SUCCESS)
//	{
//		Timeout--;
//		if(Timeout==0)break;
//	}
//}

//void I2C_I2CWriteData(uint8_t Address,uint8_t Data)
//{
//	while(I2C_GetFlagStatus(I2C2,I2C_FLAG_BUSY)==SET);
//	
//	I2C_GenerateSTART(I2C2,ENABLE);
//	while(I2C_CheckEvent(I2C2,I2C_EVENT_MASTER_MODE_SELECT)!=SUCCESS);
//	
//	I2C_Send7bitAddress(I2C2,0xD0,I2C_Direction_Transmitter);
//	while(I2C_GetFlagStatus(I2C2,I2C_FLAG_ADDR)==RESET);
//	LED_BON();
//	while(I2C_CheckEvent(I2C2,I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED)!=SUCCESS);

//	I2C_SendData(I2C2,Address);
//	while(I2C_CheckEvent(I2C2,I2C_EVENT_MASTER_BYTE_TRANSMITTING)!=SUCCESS);
//	
//	I2C_SendData(I2C2,Data);
//	while(I2C_CheckEvent(I2C2,I2C_EVENT_MASTER_BYTE_TRANSMITTED)!=SUCCESS);
//	
//	I2C_GenerateSTOP(I2C2,ENABLE);
//}

//uint8_t I2C_I2CReceiveData(uint8_t Address)
//{
//	I2C_GenerateSTART(I2C2,ENABLE);
//	while(I2C_CheckEvent(I2C2,I2C_EVENT_MASTER_MODE_SELECT)!=SUCCESS);
//	
//	I2C_Send7bitAddress(I2C2,0xD0,I2C_Direction_Transmitter);
//	while(I2C_CheckEvent(I2C2,I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED)!=SUCCESS);

//	I2C_SendData(I2C2,Address);
//	while(I2C_CheckEvent(I2C2,I2C_EVENT_MASTER_BYTE_TRANSMITTED)!=SUCCESS);

//	I2C_GenerateSTART(I2C2,ENABLE);
//	while(I2C_CheckEvent(I2C2,I2C_EVENT_MASTER_MODE_SELECT)!=SUCCESS);
//	
//	I2C_Send7bitAddress(I2C2,0xD0,I2C_Direction_Receiver);
//	while(I2C_CheckEvent(I2C2,I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED)!=SUCCESS);
//	
//	I2C_AcknowledgeConfig(I2C2,DISABLE);
//	I2C_GenerateSTOP(I2C2,ENABLE);
//	while(I2C_CheckEvent(I2C2,I2C_EVENT_MASTER_BYTE_RECEIVED)!=SUCCESS);

//	uint8_t Data=I2C_ReceiveData(I2C2);
//	I2C_AcknowledgeConfig(I2C2,ENABLE);
//	
//	return Data;
//}
